package com.owlab.dcs;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

public class TailServer implements Runnable{
	private Logger logger = null;
	private Socket socket;

	TailServer(Socket socket){
		logger = Logger.getLogger(this.getClass().getName());
		
		this.socket = socket;
		
		logger.log(Level.INFO, "A TailServer created.");
	}
	@Override
	public void run() {
		String request = null;
		BufferedReader in = null;
		PrintWriter out = null;
		try {
			in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
			out = new PrintWriter(socket.getOutputStream(),true);

			// maybe "s"
			request = in.readLine();
			
			// reply "e" as response
			out.println("e");

			// closing
			out.close();
			in.close();
			socket.close();
		}catch(IOException e){
			System.out.println(e);
			System.exit(-1);
		}

	}



}
